package com.xhsj.user.hr.process.processDefinition.service;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xhsj.user.hr.base.BaseService;
import com.xhsj.user.hr.process.hrLeaveProcess.query.ApprovalHiTaskQuery;
import com.xhsj.user.hr.process.processDefinition.entity.TbGlobalApprovalHiTask;
import com.xhsj.user.hr.process.processDefinition.mapper.TbGlobalApprovalHiTaskMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * <p>
 * 流程-历史表 服务实现类
 * </p>
 *
 * @author liuqinghua
 * @since Aug 31, 2020 5:17:39 PM
 */
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
//@CacheConfig(cacheNames = "TbGlobalApprovalHiTask")
public class TbGlobalApprovalHiTaskService extends ServiceImpl<TbGlobalApprovalHiTaskMapper, TbGlobalApprovalHiTask> {
    @Autowired
    private TbGlobalApprovalHiTaskMapper dao;

	/**
	 * 保存
	 * @author liuqinghua
	 * @date Aug 31, 2020 5:17:39 PM
	 */
    @Override
    //@CacheEvict(cacheNames="TbGlobalApprovalHiTask", allEntries=true)
    public boolean save(TbGlobalApprovalHiTask entity) {
        return super.save(entity);
    }

	/**
	 * 通过id获取数据
	 * @author liuqinghua
	 * @date Aug 31, 2020 5:17:39 PM
	 */
    @Override
    //@Cacheable(key = "#id",sync = true)
    public TbGlobalApprovalHiTask getById(Serializable id) {
        return super.getById(id);
    }

	/**
	 * 通过id删除数据
	 * @author liuqinghua
	 * @date Aug 31, 2020 5:17:39 PM
	 */
    @Override
    //@CacheEvict(cacheNames="TbGlobalApprovalHiTask", allEntries=true)
    public boolean removeById(Serializable id) {
        return super.removeById(id);
    }

	/**
	 * 批量删除数据
	 * @author liuqinghua
	 * @date Aug 31, 2020 5:17:39 PM
	 */
    //@CacheEvict(cacheNames="SysDict", allEntries=true)
    @Override
    public boolean removeByIds(Collection<? extends Serializable> idList) {
        return super.removeByIds(idList);
    }

    /**
     * 审批意见
     * @author liuqinghua
     * @date Aug 31, 2020 5:17:39 PM
     */
    public List<ApprovalHiTaskQuery> getApprovalHiTaskList(Long dataId, Long businessId) {
        return dao.getApprovalHiTaskList(dataId,businessId);
    }

    public void updateDataIdByBusInessIdAndDataId(Long businessId, Long dataId, long oldId) {
        dao.updateDataIdByBusInessIdAndDataId(businessId,dataId,oldId);
    }
}
